package com.beauty.mapper;

import com.beauty.models.User;
import org.apache.ibatis.annotations.Select;

public interface IUserMapper {
    /**
     *  根据userId获得用户信息
     * @param id
     * @return
     */
    @Select("SELECT * FROM user WHERE id = #{id}")
    public User selectUserById(String id);

    /**
     * 根据用户名获得用户信息
     * @param name
     * @return
     */
    @Select("SELECT * FROM user WHERE name = #{name}")
    public User selectUserByUserName(String name);

    /**
     * 插入（新增）用户
     * @param id
     * @param name
     * @param password
     * @param avatar
     */
    @Select("INSERT INTO user VALUES (#{id},#{name},#{password},#{avatar})")
    public void InsertUser(String id, String name, String password, String avatar);

    /**
     * 更换头像
     * @param id
     * @param avatar
     */
    @Select("UPDATE user SET avatar = #{avatar} WHERE id = #{id}")
    public void UpdateAvatar(String id, String avatar);
}
